import { request, uploadFile } from '@/utils/request';
import { PageParams } from '@/types/global';

//获取订单列表
export const getOrderList = (data: PageParams & { state?: number }) =>
    request<any>({
        method: 'POST',
        url: '/order/page/list',
        data
    });

//新增订单
export const addOrder = (data: { goodsId: number; goodsPrice: number | string; couponId:number }) =>
    request<any>({
        method: 'POST',
        url: `/order/add`,
        data
    });

//完成订单
export const completeOrder = (params: { orderId: number }) =>
    request<any>({
        method: 'POST',
        url: `/order/complete?orderId=${params.orderId}`
    });

//订单总览
export const orderOverview = (data: { startTime: string; endTime: string }) =>
    request<any>({
        method: 'POST',
        url: `/order/overview?startTime`,
        data:{
            ...data,
            hideLoading: true
        },
    });

//获取订单详情
export const getOrderInfo = (params: { orderId: number }) =>
    request<any>({
        method: 'GET',
        url: `/order/info?orderId=${params.orderId}`
    });
